Compile deps with optimizations for benches
authorAlex Crichton <alex@alexcrichton.com>
Tue, 21 Oct 2014 15:56:43 +0000 (08:56 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 21 Oct 2014 16:29:05 +0000 (09:29 -0700)
Previously only the local package was erroneously compiled with optimizations.

Closes #728

src/cargo/ops/cargo_rustc/context.rs
tests/test_cargo_bench.rs

index e3762012ffaf94b325e0ba760d1d4dcf1de383af..c0a36a757465c8dd70531bf0a4062354713b05da 100644 (file)
@@ -276,13 +276,14 @@ impl<'a, 'b> Context<'a, 'b> {
 
     pub fn is_relevant_target(&self, target: &Target) -> bool {
         target.is_lib() && match self.env {
-            "doc" | "test" | "bench" => target.get_profile().is_compile(),
+            "doc" | "test" => target.get_profile().is_compile(),
             // doc-all == document everything, so look for doc targets and
             //            compile targets in dependencies
             "doc-all" => target.get_profile().is_compile() ||
                          (target.get_profile().get_env() == "doc" &&
                           target.get_profile().is_doc()),
-            _ => target.get_profile().get_env() == self.env,
+            _ => target.get_profile().get_env() == self.env &&
+                 !target.get_profile().is_test(),
         }
     }
 }
index 6d009c0d427b94db204aeadc5f4f77d31e82fb0d..d1d4da7959eec9595bee1423a2cdc70eefed2847 100644 (file)
@@ -655,11 +655,11 @@ test!(bench_dylib {
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} bar v0.0.1 ({dir})
-{running} [..]
+{running} [..] --opt-level 3 [..]
 {compiling} foo v0.0.1 ({dir})
-{running} [..]
-{running} [..]
-{running} [..]
+{running} [..] --opt-level 3 [..]
+{running} [..] --opt-level 3 [..]
+{running} [..] --opt-level 3 [..]
 {running} [..]target[..]release[..]bench-[..]
 
 running 1 test